
pkgname=gdbm
pkgver=1.16
pkgrel=1
pkgdesc="GNU database library"
url="https://www.gnu.org/software/gdbm/gdbm.html"
license=('GPL')
arch=('x86_64')
depends=('glibc' 'sh')
source=("https://ftp.nluug.nl/pub/gnu/gdbm/${pkgname}-${pkgver}.tar.gz"
        'gdbm-1.10-zeroheaders.patch')
options=('!libtool' '!makeflags')
md5sums=('05ee82b8f9188a8228c2384f4b9f2eac'
         '2a5979910c338dabda6935263b3d8af9')
build() {
  cd ${pkgname}-${pkgver}

  #patch -p1 -i ${srcdir}/gdbm-1.10-zeroheaders.patch

  ./configure --prefix=/usr \
    --mandir=/usr/share/man \
    --infodir=/usr/share/info \
    --enable-libgdbm-compat
  make 
}

check() {
  cd ${pkgname}-${pkgver}
  
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  install -dm755 ${pkgdir}/usr/include/gdbm
  ln -sf ../gdbm.h ${pkgdir}/usr/include/gdbm/gdbm.h
  ln -sf ../ndbm.h ${pkgdir}/usr/include/gdbm/ndbm.h
  ln -sf ../dbm.h  ${pkgdir}/usr/include/gdbm/dbm.h
}
